windows: integrate Windows into shared CI matrices (R8, depends on #2422) - #2425
Conversation
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Compared with |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@fennoai please review the completed R8 shared-CI integration. All Linux, macOS, and Windows jobs and the Codecov patch gate are passing. |
There was a problem hiding this comment.
Review: Windows R8-on-R7 integration
Reviewed the R8-only range (09a23ef..f293677, 84 files) — the actual scope of this PR per the description; the full base-diff also carries the stacked #2422 work, which is out of scope here.
This is a large, well-executed portability change: CI matrix consolidation (removing windows.yml), platform-split demos, portable LLDB tooling, and Windows PE metrics. Test coverage is strong — nearly every production change is paired with a test (TestAddPESections, TestWindowsTarXzTools, TestWindowsDebugPointerParameter, TestRunQuietIncludesCommandOutput, etc.). Comments explain the Windows-specific rationale well. No high-severity or blocking issues found; the notes below are refinements.
Cross-cutting notes (no reliable single inline location):
- Supply-chain —
github.com/cpunion/libreplacement. The rootgo.mod:30and all demo/toolgo.modfiles replacegithub.com/goplus/libwith a personal fork pinned tov0.0.0-20260822071805-ebe22363a225. The PR body already flags this as temporary, which is right — the important one is the rootgo.mod(the compiler build itself), not just the demos.go.sumhashes guard against tampered fetches, but this should revert to an upstream-owned tag before release. Tracking this is worthwhile. internal/crosscompile/fetch.go—.tar.xzextraction trust path. The Go-nativeextractTarGz/extractZippaths enforce a path-traversal (illegal file path) guard; the.tar.xzpath shells out to externaltar/bsdtar/MSYS2tarwith--force-localand relies on the tool's own protections. Combined with downloads still having no checksum/signature verification (downloadFile), a moved/altered release archive could write outsidedest. This is largely pre-existing (the PR only changed tool selection), but pinning checksums for the ESP/WASI archives would close the gap._demo/c/syncdebug/once_default.govsonce_windows.go. The two files implement the samellsync.Oncetest with gratuitously different structure (package-level vars + named funcs vs. locals + closures). If the closure form works on Windows it almost certainly works everywhere; a shared implementation (or a comment explaining why they must differ) would reduce drift risk.
Verified and dismissed: an internal reviewer flagged test_windows_runtime.ps1 referencing a missing check_windows_imports.ps1, but that file exists at .github/workflows/check_windows_imports.ps1 — not an issue.
|
FennoAI is processing your request, please wait a moment... |
|
Review follow-up:
|
There was a problem hiding this comment.
Review: R8 shared-CI Windows integration
Reviewed the locked R8-only range e1791699...f2936775 (357 files, ~13.7k/-2.2k). Focus was the production runtime/codegen surface — Windows fault handling, SEH unwind, semaphores, threading, RNG, print, setjmp, and the CI matrix reshaping. Four review passes ran (quality, performance, security, docs).
Overall: high-quality, carefully engineered work. The _default/_windows/_windows_<arch> build-tag partitioning is, in nearly every family I checked (setjmp, fault, cpuprof, sema, foreign-thread, ffi-abi, gc-threads, llvm-config), provably complete and non-overlapping, and the native C/asm bridges (rand, fault handler, print, syscall, setjmp, thread/FLS) are bounds-checked with no memory-safety, injection, or weak-randomness issues found. CI trust boundaries are sound: pull_request (not pull_request_target), contents: read, secrets confined to appropriate steps, toolchain pins consistent (Go 1.26.7 / LLVM 19 / VS2022).
A few items worth a look, left as inline comments. None are blocking.
Notes (not inline):
- Supply-chain (Medium):
replace github.com/goplus/lib => github.com/cpunion/libis added to the root and every sub-modulego.mod(_xtool,doc/_readme,_demo/{c,go,py,embed}). Content is pinned +go.sum-verified, and the PR body flags it as temporary — recommend gating release on moving these commits to an org-owned/tagged upstream so a released version never depends on a personal fork. (Inline note on rootgo.mod.) - CI hardening (Low, pre-existing):
.github/workflows/benchmark.ymlinterpolates${{ github.event.pull_request.base.ref }}directly into arun:block. The line itself is pre-existing (this PR only addsshell: bashto that step), exploitability is low (base ref is an existing branch name,pull_requesttrigger,contents: read, no secrets), but normalizing to theenv:-indirection pattern already used elsewhere in the same file would be good hygiene.
Verification of the described validation matrix (287 packages, ./test/go, coverage %, LLDB suite, cross-target runtime builds) relies on the CI results reported as green; I reviewed the code and configuration, not the live job logs.
Additional findings
runtime/internal/lib/runtime/runtime_windows.go:1: [P2] Windows build-tag overlaps baremetal/wasm (duplicate LLGoFiles):runtime_windows.gois tagged//go:build windows, while siblingruntime_baremetal.gois//go:build baremetal || wasm. Awindows && (baremetal || wasm)build satisfies both, and both declareLLGoPackage/LLGoFilesconstants — that configuration would fail with duplicate declarations.runtime_default.goin the same package correctly excludes windows (!baremetal && !wasm && !windows), so this is the one file in the family whose tag isn't provably disjoint. Ifwindows && baremetal/windows && wasmis not a real target the impact is latent, but tightening to//go:build windows && !baremetal && !wasmremoves the ambiguity at zero cost.
|
CI follow-up: the attempted Reverted that change in b7fce75, documented the required platform distinction in 4b8549e, and locally verified the Unix fixture through LLGo. The two inline review fixes remain intact. |
|
Once ABI follow-up:
|
6275c2a to
63831cd
Compare
This reverts commit 2910a58.
63831cd to
798ad5c
Compare
|
@fennoai please review the current completed R8 diff at |
There was a problem hiding this comment.
FennoAI Review — Windows R8-on-R7 integration
Large, well-structured PR. Build-tag splits (*_windows.go / *_default.go / *_unix.go), the crosscompile Windows toolchain selection, the MSVC import-library resolver, and the sync/once simplification are clean and well-covered by new tests. No blocking correctness regressions found. A few items worth confirming before merge, plus inline notes.
Items without a single reliable inline location:
- Fork dependency in mainline modules. Every
go.mod(root,_demo/*,_xtool,doc/_readme) addsreplace github.com/goplus/lib => github.com/cpunion/lib v0.0.0-20260827173821-.... This redirects the whole C/OS binding surface (sockets, os, net) to a personal fork.go.sumpins it so it isn't silently mutable, but please confirm this is a temporary bootstrap to be reverted to a tagged upstreamgoplus/librelease before merge. Somego.sumfiles also retain an older unused pseudo-version (...20260822071805-...) thatgo mod tidywould drop. .github/workflows/benchmark.yml(~L47–51):git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }}.git ${{ github.event.pull_request.base.ref }}interpolates PR metadata directly into arun:block. These are maintainer-controlled target-branch values (low risk) and the PR only addedshell: bashhere, but passing them viaenv:and quoting"$VAR"is the safer pattern.- Downloaded toolchain archives lack checksum/signature verification (
internal/crosscompile/fetch.godownloadFile). The PR adds a new Windows source (github.com/espressif/llvm-project/releases/...) whose archive is extracted then executed as the compiler. Pin-by-tag helps but recording/verifying a SHA-256 would close the gap — especially combined with theextractZipnote below.
Findings without inline locations
internal/crosscompile/fetch.go:362:extractZipwrites tofilepath.Join(dest, file.Name)with no containment check, so a crafted entry like../../evilcan escapedest(zip-slip). The siblingextractTarGzalready guards this (illegal file pathcheck). Current sources are trusted/HTTPS so exploitability is limited, but since this file is being touched for Windows it's worth adding the same prefix check (plus a symlink guard) here.README.md:356: The install guide still reads### on Windows/TODO, but this PR makes Windows a CI-tested target —doc.ymleven runs the README code blocks onwindows-2022, so the docs are exercised on Windows while telling users installation is unimplemented. Please fill this in (mirroring the CIsetup-depssteps) or mark it experimental. The support matrix around L50–56 also omits the new Windows amd64 native CI coverage.
|
FennoAI is processing your request, please wait a moment... |
|
FennoAI follow-up:
|
There was a problem hiding this comment.
Re-review: R8 diff at 29a713b47 (post-#2422)
Re-reviewed the locked range ff9bad85...29a713b4 (128 files, +2550/-775). Now that dependency #2422 has merged, this is a genuinely R8-only diff — much smaller and cleaner than the earlier stacked view. Ran all four passes (quality, performance, security, docs).
Prior findings — status:
- Build-tag overlap (
runtime_windows.go) andsemaReleasewake-per-release — both now land at the merged base via #2422 and are outside this PR's diff range. Not re-flagged here; they belong to #2422's history. goplus/lib→cpunion/libreplace — still present and re-introduced by this PR (see below).
New results this pass:
- Quality: No in-range findings. Spot-verified correct: the
_default/_unix/_windowssync splits,macho_size.goclose-before-rename handling on Windows,clang.goCommandLineToArgvWbackslash quoting, andssa/eh.goarch-dispatched setjmp/longjmp. - Performance: No regressions. The crosscompile archiving change (long argv →
objects.rspresponse file forllvm-ar) is a scalability improvement for the many-object newlib case; the Windows GNU tar/xz path is a large win;resolveMSVCImportLibrariesis bounded one-time link-step cost gated behind a fast-path check that leaves non-MSVC builds untouched. - Security: CI trust boundaries are sound —
pull_request(notpull_request_target),persist-credentials: falseon untrusted checkouts, dispatch/token jobs gated to non-PR events onxgo-dev/llgowith ref/SHA validation, and the native C shims (profile_windows.c,sync_windows.c) are bounds-checked with overflow-aware deadline math. One finding, inline below. - Docs: No findings. Renamed
llvm_config_windows.gocomment matches the new name/behavior; toolchain pins (Go 1.26.7 / LLVM 19 / VS2022) are internally consistent.
I reviewed code and configuration, not the live CI logs — the reported green matrix and 97.98% patch coverage are taken as stated.
|
|
||
| replace github.com/xgo-dev/llgo/runtime => ./runtime | ||
|
|
||
| replace github.com/goplus/lib => github.com/cpunion/lib v0.0.0-20260827173821-b993779acb60 |
There was a problem hiding this comment.
[P2] Reintroduces goplus/lib -> cpunion/lib personal-fork replace
This range adds replace github.com/goplus/lib => github.com/cpunion/lib v0.0.0-20260827173821-b993779acb60. The merged base (post-#2422) tracks upstream github.com/goplus/lib v0.3.1 with no replace, so this PR moves the dependency — which is compiled into essentially every LLGo-built binary — back to a personal fork, and propagates the same replace across _xtool/go.mod, doc/_readme/go.mod, and _demo/{c,go,py,embed}/go.mod. The pseudo-version is content-pinned via go.sum (tampering-after-the-fact is guarded), but a personal-account fork is a weaker trust/longevity anchor for a shared project. Since the base already uses the org-owned upstream, recommend dropping this replace before merge, or gating release on repointing to an xgo-dev/org-owned tagged source and diffing the fork against upstream. Prior review flagged this as temporary; it is still present with a bumped version.
|
Post-review validation at |
Depends on #2422. Part of the Windows support proposal in #2325.
The R8-only review range is
4973ccf1059fea0e346c4c0cde3d63e7b63b60aa..c059f643a. Until #2422 merges, GitHub's full diff also contains the stacked R7 work.What this changes
windows.ymlworkflow and addswindows-2022to the existing Go, LLGo, GOROOT, standard-library coverage, docs-local, build-cache, and benchmark matrices.setjmp/longjmpat the call site, where thereturns_twicesemantics are preserved. Windows selects the native 386/amd64 entry points and the required ARM64 helper.Once.Doaccepts a//llgo:type Cbarevoid (*)(void)callback. The Windows C wrapper only adapts that callback toInitOnceExecuteOnce; no Go closure representation crosses the boundary.Remote-install coverage is intentionally unchanged, as agreed in #2325. Removing the MSYS2 host-toolchain dependency is R9; clean release artifacts and broader debugger qualification remain later proposal work.
The temporary
github.com/cpunion/libreplacements provide the Windows-native C/C++ bindings exercised here. Their upstream contribution is goplus/lib#26, whose macOS, Linux, and Windows checks currently pass. Removing the replacements is a merge/release gate once an upstream-owned revision is available. Windows/386 bindings that requirestdcalluse a thin C bridge because LLGo does not yet model that calling convention; x64 and ARM64 use the unified Windows ABI directly.Validation
windows/amd64qualification:./test/gopassed in 641 seconds;clpassed with 96.6% statement coverage,ssawith 95.1%,internal/crosscompilewith 82.2%, andinternal/cabiwith 86.3%;python312.dll.setjmp, demangle, and libc fixture changes pass IR and actual-execution tests on their applicable native hosts. The POSIXpthread_oncefixture is explicitly not applicable on Windows.go test ./ssaand the complete nativeTestRunAndTestFromTestlibcsuite pass locally on macOS; the corresponding Windows demangle execution and fixture selection pass in the VM.c059f643a, including the three-platform Go, LLGo, build-cache, benchmark, installation, standard-library coverage, and release-artifact jobs. The Windows full-coverage, LLGo-primary, test-shard, and benchmark jobs completed in 44m09s, 16m59s, 28m00s, and 8m05s respectively.git diff --checkpasses.